package com.sanjin.form;

import com.sanjin.form.interfaces.Create;
import com.sanjin.form.interfaces.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.math.BigDecimal;

/**
 * @description:
 * @author: sanjin
 * @date: 2019/5/5 13:57
 */
@ApiModel
@Data
public class ParkLotForm {

    @ApiModelProperty(value = "id，update必须传递，create不允许传递")
    @NotNull(groups = Update.class, message = "update 必须包含id")
    @Null(groups = Create.class, message = "create 不允许包含id")
    private Integer id;

    /**
     * 名称
     */
    @ApiModelProperty(value = "停车场名称")
    @NotEmpty(message = "name 不能为空")
    private String name;

    /**
     * 纬度
     */
    @ApiModelProperty
    @NotNull(message = "latitude 不能为空")
    private BigDecimal latitude;

    /**
     * 经度
     */
    @ApiModelProperty
    @NotNull(message = "longitude 不能为空")
    private BigDecimal longitude;

    /**
     * 详细地址
     */
    @ApiModelProperty
    @NotEmpty(message = "address 不能为空")
    private String address;

    /**
     * 状态
     */
    @ApiModelProperty(value = "状态，默认0，create 不能有此字段，update必须传递")
    @Range(min = 0, max = 2, groups = Update.class, message = "status在0 - 2范围内")
    @NotNull(groups = Update.class, message = "update必须包含status")
    @Null(groups = Create.class, message = "create 不能包含status")
    private Integer status;
}
